<?php

namespace app\admin\annotation\common;

use Attribute;
use think\facade\Log;

#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
class Auth
{
    public array|string $permissions;
    public string $mode; // 'and' or 'or'

    public function __construct(array|string $permissions, string $mode = null)
    {
        $this->permissions = is_array($permissions) ? $permissions : [$permissions];
        $this->mode = $mode ?: config('rds.auth_mode');
    }
}